<DOCTYPE html>
<html>
<head>
    <title>商店</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?php foreach ($this->config->item('style_css_paths') as $css): ?>
      <link rel="stylesheet" href=<?php echo $css ?> />
    <?php endforeach ?>
    <?php foreach ($this->config->item('style_js_paths') as $js): ?>
      <script type="text/javascript" src=<?php echo $js?> ></script>
    <?php endforeach ?>
    <!-- bxSlider Javascript file -->
    <script src=<?php echo base_url("/scripts/jquery.bxslider.min.js") ?>></script>
    <!-- bxSlider CSS file -->
    <link href=<?php echo base_url("/scripts/jquery.bxslider.css") ?>  rel="stylesheet" />
    <script type="text/javascript" src=<?php echo base_url("/scripts/logic/uihelper.js") ;?>></script></head>
<body>
        <div data-role="page" id="shop"> 

        <div data-role="header" style="overflow:hidden;" data-theme="a" data-tap-toggle="false" data-position="fixed">
            <!-- <h1>店铺</h1> -->
            <div data-role="navbar" >
                <ul>
                    <li><a href="#" class="ui-btn-active ui-btn-icon-right ui-icon-shop">外卖</a></li>
                    <li><a href=<?php echo site_url('grouppurchase'); ?> class="ui-btn-icon-right ui-icon-grid">团购</a></li>
                </ul>
            </div><!-- /navbar -->
        </div><!-- /header -->       

        <div role="main" class="ui-content">
            <ul data-role="listview" data-inset="true" data-theme="C">
              <!-- <li data-role="divider">外卖店铺</li> -->

              <!--输出营业店铺-->


              <?php foreach ($store_list as $item): {?>
                <?php
                    $store_open_time = strtotime($item['store_open_time']);
                    $store_close_time = strtotime($item['store_close_time']);
                    $time = time();
                    $store_state = $item['store_state'];
                ?>
                <?php if ( (($store_open_time<$store_close_time and $time>$store_open_time and $time<$store_close_time) 
                    or ($store_open_time>$store_close_time and ($time>$store_open_time or $time<$store_close_time)))
                    and $store_state == 1) {;?>

                 <li>
                    <a href="<?php echo site_url('welcome/store?store_id=') . $item["store_id"]; ?>">
                        <img src="<?php echo base_url($item["store_pic"]); ?>"/>
                        <h2><?php 
                                    echo $item["store_name"];
                                 ?></h2>
                        <p><?php echo $item["store_note"];?></p>
                    </a>
                </li>
                <?php } ?>
              <?php } endforeach ?>


              <!--输出营业店铺-->


              <?php foreach ($store_list as $item): {?>
                <?php
                    $store_open_time = strtotime($item['store_open_time']);
                    $store_close_time = strtotime($item['store_close_time']);
                    $time = time();
                    $store_state = $item['store_state'];
                ?>
                <?php if ( $store_state == 4 ) {;?>

                 <li>
                    <a href="">
                        <img src="<?php echo base_url($item["store_pic"]); ?>"/>
                        <h2><?php 
                                    echo "[忙碌]";
                                    echo $item["store_name"];
                                 ?></h2>
                        <p><?php echo $item["store_note"];?></p>
                    </a>
                </li>
                <?php } ?>
              <?php } endforeach ?>

              <!--输出打烊店铺-->


              <?php foreach ($store_list as $item): {?>
                <?php
                    $store_open_time = strtotime($item['store_open_time']);
                    $store_close_time = strtotime($item['store_close_time']);
                    $time = time();
                    $store_state = $item['store_state'];
                ?>
                <?php if (!( (($store_open_time<$store_close_time and $time>$store_open_time and $time<$store_close_time) 
                    or ($store_open_time>$store_close_time and ($time>$store_open_time or $time<$store_close_time)))
                    and $store_state == 1)) {

                    if ($store_state == 4)
                      continue;
                    
                    ;?>

                 <li>
                    <a href="">
                        <img src="<?php echo base_url($item["store_pic"]); ?>"/>
                        <h2><?php 
                                    echo "[打烊]";
                                    echo $item["store_name"];
                                 ?></h2>
                        <p><?php echo $item["store_note"];?></p>
                    </a>
                </li>
                <?php } ?>
              <?php } endforeach ?>


              <!--输出打烊店铺-->

            </ul>        
        </div>  
        
        <div data-role="footer" data-tap-toggle="false" data-position="fixed">
            <div data-role="navbar">
              <ul>
                <li><a href=<?php echo site_url('welcome');?> data-icon="home">主页</a></li>
                <li><a href=<?php echo site_url("welcome/shop") ;?> data-icon="shop" class="ui-btn-active ui-state-persist">店铺</a></li>
                <li><a href=<?php echo site_url('welcome/history');?>  data-icon="check">历史订单</a></li>
                <li><a href=<?php echo site_url("welcome/info") ;?> data-icon="info">个人信息</a></li>
              </ul>
            </div>
        </div>
    </div>
</body>
</html>
